import request from "@/utils/request";
import Common from "../common";

// 获取当前用户可用的审批流程分组及组下流程(发起审批人员选择要发起的审批时使用)
// /approval/api/v1/approFlowGroups/allCanUseByUser/hr
export function allCanUseByUser(params) {
  return request({
    url: "/approval/api/v1/approFlowGroups/allCanUseByUser/hr",
    method: "get",
    params
  });
}

function Approval({ url, method = "GET", data, params }) {
  return request({
    url,
    method,
    data,
    params
  });
}

class ApprovalApi {
  // 我审批的 人员申请审批人表 人员申请审批信息表
  static myApproval = `/approval/api/v1/userFlowApprovers/listUserApprosApprovedByMe`;
  // 我发起的
  static creFromMe = `/approval/api/v1/userFlowApprovers/pageUserApprosCreateByMe`;
  // 抄送我的
  static ccMe = `/approval/api/v1/userFlowApprovers/pageUserApprosNotifierMe`;
  // 审批类型
  static approvalType = `/approval/api/v1/approFlows/allByGroup/`;

  // 创建审批
  static createSP = `/approval/api/v1/userAppros`;
  // 创建自选审批
  static freeForm = `/hr/api/v1/userAppros/getFlowProcessByApproInfo`;
  // 人员审批表
  static peoAppList = `/approval/api/v1/userAppros/listAll`;
  // 获取审批总组
  static allBySite = `/approval/api/v1/approFlowGroups/allGroupAndFlowBySite/`;
  // 新建单个审批
  static aApproval = `/approval/api/v1/approFlowForms/allCanUseByFlow/`;
  // 我发起的审批
  static fqApproval = `/approval/api/v1/userApprovers/pageUserApprosCreateByMe`;
  // 总的审批表单
  static allForm = `/approval/api/v1/approFlowGroups/allGroupAndFlowByCompanyUser/`;
  // 单个审批表单 详情
  static detForm = `/hr/api/v1/userAppros/getFlowProcessByApproInfo`;
  // 获取公司下可用的审批流程(当前用户可用的)
  static allByCompanyAndUser = `/approval/api/v1/approFlowGroups/allGroupAndFlowByCompanyUser/`;
  // 获取审批流程组下所有审批流程(当前用户可用的)
  static allByGroupAndUser = `/approval/api/v1/approFlows/allByGroupAndUser/`;
  // 角色
  static role = `hr/api/v1/permissions/roleList`;
  // 获取流程信息
  static getAppDetail = `/approval/api/v1/approFlows/allFolwProcess/`;
  // /approval/api/v1/userAppros/{userApproId}根据人员申请审批表id查询人员申请审批表详情
  static appDetail = `/approval/api/v1/userAppros/`;
  // 新增审批表单 根据用户填写的信息获取匹配的流程(展示和用户自选审批人、抄送人使用)
  static createNewForm = `/hr/api/v1/userAppros/getFlowProcessByApproInfo`;
  // 用户选择审批人/抄送人
  static userChose = `/approval/api/v1/userAppros`;
  // 我审批通过
  static sureApp = `/approval/api/v1/userFlowApprovers/pass/`;
  // 我拒绝审批
  static rejectApp = `/approval/api/v1/userFlowApprovers/reject/`;
  // 发起人撤回
  static reBackApp = `/approval/api/v1/userAppros/revoke/`;
  /* 人员申请审批表 查看审批详情 */

  static appItemDetail = `/approval/api/v1/userAppros/userApproDetails/`;
  // 查看人力审批详情  hrApproval-人力审批接口
  static hrAppDetail = `/hr/api/v1/hrApproProviders/userApproDetails/`;
  // 撤回后重新发起审批
  static reTimeApp = `/approval/api/v1/userApproInfos/listFormReLaunch/`;
}

/* 我审批的 获取由我审批的用户审批信息*/

/* 我抄送的 */
/* 我发起的 */

export { Approval, ApprovalApi, Common };
